﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using OgilvyOne.Model;
using OgilvyOne.BLL;

public partial class admin_infomation_info_seo : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.header.Text = new ColumnBll().LayeridColumnConNaiv(Layerid);
            if (Request.Params["id"] != null && Request.Params["id"] != "")
            {
                int aid = int.Parse(Request.Params["id"]);
                CmsArticleModel cm = new CmsArticleBll().GetCmsArticelSeo(aid);
                this.header.Text = this.header.Text + "&nbsp;&nbsp;<img src='../images/subnav_dot.gif' />&nbsp;&nbsp;" + cm.Title;
                this.aid.Value = aid.ToString();
                this.title.Text = cm.Articletitle;
                this.keywords.Text = cm.Articlekeyword;
                this.metadesc.Text = cm.Articledesc;
                if (cm.Staticpagename == null || cm.Staticpagename.Trim() == "")
                {
                    this.staticpagename.Text = aid + ".html";
                }
                else
                {
                    this.staticpagename.Text = cm.Staticpagename;
                }
                this.isstaticpub.Text = cm.Isstaticpub;
            }
        }
    }

    protected void Sub_click(object sender, EventArgs e)
    {
        int aid = int.Parse(this.aid.Value);
        CmsArticleModel cm = new CmsArticleModel();
        cm.Articleid = aid;
        cm.Articlekeyword = this.keywords.Text;
        cm.Articletitle = this.title.Text;
        cm.Articledesc = this.metadesc.Text;
        cm.Staticpagename = this.staticpagename.Text;
        cm.Modifyusername = GetSessionUsersModel().Username;
        cm.Isstaticpub = this.isstaticpub.Text;

        if(new CmsArticleBll().UpdateSeo(cm))
        {
            insertLog("修改文章SEO:" + new CmsArticleBll().GetCmsArticleModel(aid).Title);
        }
        Response.Redirect("info_list.aspx?columnid=" + Request.Params["columnid"] + "&layerid=" + Request.Params["layerid"], true);
    }
}
